package com.yicong.ants.view.dialog;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.cchao.simplelib.core.UiHelper;
import com.yicong.ants.R;
import com.yicong.ants.utils.DisplayUtils;

/**
 * 转赠提示弹窗status 0退回 1确认
 */
public class GiftConfirmationDialog extends BaseNiceDialog implements View.OnClickListener {

    private int status;

    public GiftConfirmationDialog(Context context , int status) {
        this.status = status;
        setOutCancel(true);
        setWidth(DisplayUtils.px2dp(context, (float) (UiHelper.getScreenWidth() * 0.8)));
        setDimAmount(0.3f);
    }

    @Override
    public int intLayoutId() {
        return R.layout.dialog_gift_confirmation;
    }

    private View.OnClickListener onClickListener;
    public void setOnClickListener(View.OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
    }

    @Override
    public void convertView(NiceViewHolder holder, BaseNiceDialog dialog) {
        TextView title = holder.getView(R.id.title);
        TextView content = holder.getView(R.id.content);
        if (status == 0) {
            title.setText("转赠退回");
            content.setText("退回后门票将原路返回至对方门票仓库中");
        } else {
            title.setText("转赠二次确认");
            content.setText("已核实身份信息，确认转赠。");
        }
        holder.getView(R.id.cancel).setOnClickListener(this);
        holder.getView(R.id.confirm).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (onClickListener!=null){
            onClickListener.onClick(view);
        }
    }
}
